package com.jeesite.modules.app.util.pay;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import com.jeesite.modules.app.util.pay.conf.PayConfig;
import com.lly835.bestpay.config.WxPayConfig;
import com.lly835.bestpay.service.impl.BestPayServiceImpl;

@Component
public class WxchatPayConfig {
	@Autowired
	private PayConfig accountConfig;
	@Bean
	public BestPayServiceImpl bestPayService(){
		BestPayServiceImpl bser=new BestPayServiceImpl();
		
		bser.setWxPayConfig(wxPayConfig());
		return bser;
	}
	@Bean
	public WxPayConfig wxPayConfig(){
		WxPayConfig wxPayConfig=new WxPayConfig();
		wxPayConfig.setAppId(accountConfig.getMpAppId());
		wxPayConfig.setAppSecret(accountConfig.getMpAppSecret());
		wxPayConfig.setMchId(accountConfig.getMchId());
		wxPayConfig.setMchKey(accountConfig.getMchKey());
		wxPayConfig.setKeyPath(accountConfig.getKeyPath());
		wxPayConfig.setReturnUrl(accountConfig.getNotifyUrl());
		return wxPayConfig;
	}
}
